﻿package  
{
	import flash.display.MovieClip;
	import flash.display.Graphics;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author ...
	 */
	public class KTu  extends MovieClip
	{
		public var cellWidth:Number = 54, cellHeight:Number = 22;
		public var ktu:MovieClip = new MovieClip ();
		public const paddingwidth = 64;

		public function KTu() 
		{
			drawView (440, 305);
		}



		public function drawView (stageWidth:Number,stageHeight:Number) {
			//绘制外框
			ktu.graphics.beginFill(0xffffff,0.2);
            ktu.graphics.lineStyle(1, 0x000000,.45);
            ktu.graphics.drawRect(0, 0, stageWidth, stageHeight);
            ktu.graphics.endFill ();
			//绘制横向网格
			var PH:Number = 0,S:Number=2,maxY:Number=5000,minY:Number=0,step=0; 
				ktu.graphics.lineStyle (1, 0xadadad, .45);
				step = int(stageHeight / cellHeight);
				cellHeight = stageHeight / step;
			    ktu.graphics.moveTo (ktu.width-S, PH);
			    ktu.graphics.lineTo (0, PH);
			for (var j:int = 1; j <=step ; j++) 
			{
				ktu.graphics.moveTo (ktu.width-S, PH + cellHeight*j);
				ktu.graphics.lineTo (0, PH + cellHeight * j);	
				var t:TextField = new TextField ();
				t.text =Math.round((maxY-minY)-(j-1)*(maxY-minY)/step).toString();
				t.x = 30;   
				t.y = PH + cellHeight*j;
				addChild (t);				
			}
			

			//绘制纵向网格
			var AW:Number = 54;
			ktu.graphics.lineStyle(1, 0xadadad, .45);
			for (var k:int = 1; k <8 ; k++) 
			{
				ktu.graphics.moveTo (AW*k, 0);
				ktu.graphics.lineTo (AW*k, ktu.height-S );				
			}
			
			
			//绘制坐标
			   var array:Array = new Array ("2000", "12365", "165324", "21365", "22666", "23866", "26565", "25654", "26987", "27896", "298754"); 
			   	//var array:Array = new Array ();
			    //array.push ( { name:"tutu", born:"2009" } );
				//array.push ( { name:"mimi", born:"1998" } );
				//array.sortOn("born", Array.NUMERIC);

					for (var i:Number = 0; i <= array.length; i++ ) {
							 //trace(array[i].name, array[i].born);
					}
				
		
			
				
				
			
			//绘制曲线
				ktu.graphics.lineStyle (1, 0x9900ff, .45);
				ktu.graphics.moveTo (ktu.width - S, PH + cellHeight*6);
				ktu.graphics.curveTo (ktu.width - S, ktu.height-S, AW * 3, PH + cellHeight*6);

			
			ktu.x = (stage.stageWidth-ktu.width)/2;
			ktu.y = (stage.stageHeight - ktu.height) / 2;
			
			addChild (ktu);


		}
		
	}


	
	
	
}